package com.gitee.designpattern.strategy;

import java.math.BigDecimal;

/**
 * 模拟业务代码对策略模式的调用
 *
 * @author codeboy zhou
 */
public class UserPaymentStrategyDemo {
    /**
     * 计算用户最终应支付的订单总金额
     *
     * @param userVipLevel 用户会员等级
     * @param originalMoney 用户应支付的原始订单总金额
     *
     * @return 用户最终应支付的订单总金额
     */
    public BigDecimal needPay(UserVipLevelEnum userVipLevel, BigDecimal originalMoney) {
        return UserPaymentStrategyFactory.getUserPaymentStrategy(userVipLevel).needPay(originalMoney);
    }

    public static void main(String[] args) {
        BigDecimal originalMoney = BigDecimal.valueOf(111);
        UserPaymentStrategyDemo demo = new UserPaymentStrategyDemo();
        System.out.println(demo.needPay(UserVipLevelEnum.DEFAULT, originalMoney));
        System.out.println(demo.needPay(UserVipLevelEnum.BRONZE, originalMoney));
        System.out.println(demo.needPay(UserVipLevelEnum.SILVER, originalMoney));
        System.out.println(demo.needPay(UserVipLevelEnum.GOLD, originalMoney));
    }
}
